package com.your.company.demo.web.v1_0_0;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.strato.mvc.annotation.v1_0_0.annotation.method.PathVariable;
import com.strato.mvc.annotation.v1_0_0.annotation.method.RequestMapping;
import com.strato.mvc.annotation.v1_0_0.annotation.type.Controller;
import com.strato.mvc.api.v1_0_0.model.ModelAndView;

@Controller
@com.strato.mvc.annotation.v1_0_0.annotation.type.RequestMapping("/demo/1")
public class Controllers1 {

	@RequestMapping("/hello1")
	public void hello1(HttpServletRequest request,HttpServletResponse response) throws IOException{
		String name=request.getParameter("name");
		PrintWriter out = response.getWriter();
		out.print("Demo1:	Hello "+name);
		out.flush();
	}

	@RequestMapping("/hello2")
	public String hello1(HttpServletRequest request,ModelAndView mav) throws IOException{
		String name=request.getParameter("name");
		mav.getModel().put("name", name);
		return "velocity/hello2";
	}

	@RequestMapping("/hello3/{name}")
	public String hello3(@PathVariable String name,ModelAndView mav) throws IOException{
		mav.getModel().put("name", name);
		return "velocity/hello3";
	}
	
	@RequestMapping("/hello4/{name}")
	public String hello4(@PathVariable String name,ModelAndView mav) throws IOException{
		mav.getModel().put("name", name);
		return "velocity/hello4";
	}
	
}
